Preserve session content when switching executors#511
Merged
Conversation
When switching from one executor to another on an existing task, the previous session's conversation history is now extracted and injected into the new executor's prompt as context. This prevents losing all context when changing e.g. from Claude to Codex or Gemini. Implementation: - Add GetSessionContent(workDir) to TaskExecutor interface - Implement for all executors: Claude/Pi read JSONL sessions, Codex/Gemini parse JSON sessions with generic message extraction, OpenClaw/OpenCode return empty (no file-based sessions) - Add GetPreviousSessionContent() on Executor that checks other executors for session content when current executor has no session - Wire into both daemon (executeTask) and interactive (TUI) paths - Truncate large sessions to ~50K chars keeping most recent context Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests the 4 key branches: current executor has session (skip), other executor has session (return handoff), no sessions found (return empty), and other has session ID but empty content (skip to next). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GetSessionContent(workDir)to theTaskExecutorinterface, implemented for all 6 executors (Claude, Codex, Gemini, Pi, OpenClaw, OpenCode)How it works
GetPreviousSessionContent()checks if any other executor has session files for the same workDirTest plan
go vetclean🤖 Generated with Claude Code